package com.xp.kettlegenerate.controller;


import com.xp.kettlegenerate.service.IGenerateTableService;

import jakarta.annotation.Resource;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.trans.TransMeta;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xxx
 * @since 2024-06-17
 */
@RestController
@RequestMapping("/generate")
public class GenerateTableController {

    @Autowired
    IGenerateTableService  generateTableService;


    /**
     * 生成转换
     *
     * @return
     */
    @GetMapping
    public String generateTrans() throws KettleException {
        TransMeta transMeta = generateTableService.generateTrans();

        return "生成成功:"+transMeta.getName();
    }
}
